package cn.t235.demo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

/**
 * @author 天天向上 （john.yi@qq.com）
 * @date 2020/10/28.
 */
@Component
public class Printer {
    @Autowired
    @Qualifier("greyInk")
    private Ink ink;
    @Autowired
    @Qualifier("b5")
    private Paper paper;

    public Printer() {
//        System.out.println(ink.getColor());
    }

    public Printer(Ink ink, Paper paper) {
        this.ink = ink;
        this.paper = paper;
        System.out.println(ink.getColor());
    }

    public void setInk(Ink ink) {
        this.ink = ink;
        System.out.println(ink.getColor());
    }

    public void setPaper(Paper paper) {
        this.paper = paper;
    }

    public void print(String content) {
        System.out.println("开始打印");
        System.out.println("纸张：" + paper.getSize());
        System.out.println("墨盒：" + ink.getColor());
        System.out.println("内容：" + content);
        System.out.println("打印完成。。。。。。");
    }
}
